package com.xr.wage.pay;

import com.xr.common.CommUtil;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.SqlDataset;
import com.bstek.dorado.common.*;

 
public class PayMail_datasetWillMailListener extends AbstractDatasetListener {
  public boolean beforeLoadData(Dataset dataset) throws Exception {
	SqlDataset ds = (SqlDataset) dataset;
    String sql="";
    sql="select c.company_id,c.company_name,e.employee_name,e.employee_code,e.id_card_num," +
    		"e.id_card_type,e.mail,ws.send_month,ws.send_name,ws.send_time,p.wage_time,p.last_compute_date" +
    		" from wa_send ws,wa_psn p,org_company c,org_dept d,org_employee e " +
    		"where ws.send_id=p.send_id and p.company_id=c.company_id and p.dept_id=d.dept_id and p.employee_id=e.employee_id " +
    		"and ws.if_payed=1 and ws.send_id in("+ds.parameters().getString("selected_send")+") ";
    
    sql+=CommUtil.setConditionSQL(ds);
    sql+=" ";
    ds.setSql(sql);
    return true;
  }

}
